function getTotalFansList(data, callback) {
    $.ajax({
        dataType: "JSON",
        type: 'get',
        url: '/admin/Fans/getFansDetailList',
        data: data,
        success: function (res) {
            res.result.data.forEach(function(item){
                item.subscribe_time = changeTime(item.subscribe_time)
                if(item.unsubscribe_time != 0){
                    item.unsubscribe_time = changeTime(item.unsubscribe_time)
                }else{
                    item.unsubscribe_time = '';
                }
                
            })
            callback(res)
        }
    })
}


function getTotalPageNum(data, callback) {
    var pageArr = pageArr || {}
    pageArr[data.el] = new iPage({
        elem: data.el,
        limit: data.limit, //分页数
        curr: 1, //初始页
        count: data.count, //数据总数,
        hidenum: 10,
        topages: true,
        jump: function (obj, first) {
            data.clickPage(obj, first)
        }
    });
}

function getFootPrint(openid,callback){
    $.ajax({
        dataType: "JSON",
        type: 'get',
        url: '/admin/Fans/queryFootPrint',
        data: {openid : openid},
        success: function (res) {
            callback(res);
        }
    })
}


function loadOn() {
    $("#loadOn").show()
}

function loadClose() {
    $("#loadOn").fadeOut()
}

layui.use('laydate', function () {
    var laydate = layui.laydate;
    laydate.render({
        elem: '#chioceTime',
        type: 'datetime',
        range: true,
        done: function (value, date, endDate) {

        }
    });
    // console.log()
})


function getdate(y, m, d, h, mi, s) {
    return y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " " + (h < 10 ? "0" + h : h) + ":" + (mi < 10 ? "0" + mi : mi) + ":" + (s < 10 ? "0" + s : s);
}

function setCookie(name, value) {
    var Days = 30;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}

// 时间戳转换为日期格式
function changeTime(time){
    var date = new Date(time*1000);
    Y = date.getFullYear() + '-';
    M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
    D = date.getDate() + ' ';
    h = date.getHours() + ':';
    m = date.getMinutes() + ':';
    s = date.getSeconds(); 
    return Y+M+D+h+m+s
}